package day240510.p1;

public class Tv extends Everything {
    String name;
    double price;

    public Tv(String name,double price) {
        this.name=name;
        this.price=price;

    }

    @Override
    public String toString() {
        return "Tv{" +
                "name='" + name + '\'' +
                ", price=" + price +
                '}';
    }

    @Override
    public int compareTo(Everything everything) {Tv tv = (Tv) everything;
        if (this.price > tv.price) {
            return 1;
        } else if (this.price < tv.price) {
            return -1;
        } else {
            return 0;
        }
    }
}
